package com.stox.ui.javafx.core.widget;

import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.stox.ui.javafx.core.application.ApplicationButton;
import com.stox.ui.javafx.core.mode.ModeChoiceBox;
import com.stox.ui.javafx.core.perspective.PerspectiveChoiceBox;
import com.stox.ui.javafx.core.profile.ProfileChoiceBox;
import com.stox.ui.javafx.core.skin.SkinChoiceBox;
import com.stox.ui.javafx.core.workspace.WorkspaceChoiceBox;

@Component
public class TitleBar extends javafx.scene.control.ToolBar  implements InitializingBean {

	@Autowired
	private WindowButtons windowButtons;
	
	@Autowired
	private ApplicationButton applicationButton;
	
	@Autowired
	private WorkspaceChoiceBox workspaceChoiceBox;
	
	@Autowired
	private PerspectiveChoiceBox perspectiveChoiceBox;
	
	@Autowired
	private ProfileChoiceBox profileChoiceBox;
	
	@Autowired
	private SkinChoiceBox skinChoiceBox;
	
	@Autowired
	private ModeChoiceBox modeChoiceBox;
	
	public TitleBar() {
		super();
		setId("stox-title-tool-bar");
	}
	
	@Override
	public void afterPropertiesSet() throws Exception {
		Region spacer1 = new Region();
		HBox.setHgrow(spacer1, Priority.ALWAYS);
	    
	    HBox segmentedButtonBar = new HBox();
	    segmentedButtonBar.setId("stox-segmented-choice-box-bar");
	    segmentedButtonBar.getChildren().addAll(profileChoiceBox, workspaceChoiceBox, modeChoiceBox, perspectiveChoiceBox, skinChoiceBox);
		
	    getItems().addAll(applicationButton, spacer1, windowButtons);
	}

	public ApplicationButton getApplicationButton() {
		return applicationButton;
	}
}
